-- local ensure_packer = function()
--   local fn = vim.fn
--   local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
--   if fn.empty(fn.glob(install_path)) > 0 then
--     fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
--     vim.cmd [[packadd packer.nvim]]
--     return true
--   end
--   return false
-- end

-- vim.g.packer_bootstrap = ensure_packer()

local ensure_lazy = function()
  local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
  if not (vim.uv or vim.loop).fs_stat(lazypath) then
    vim.fn.system({
      "git",
      "clone",
      "--filter=blob:none",
      "https://github.com/folke/lazy.nvim.git",
      "--branch=stable", -- latest stable release
      lazypath,
    })
    return true
  end
  vim.opt.rtp:prepend(lazypath)

  return false
end

vim.g.lazy_bootstrap = ensure_lazy()
